import 'package:wch/generated/json/base/json_convert_content.dart';
import 'package:wch/model/device_version_entity.dart';

DeviceVersionEntity $DeviceVersionEntityFromJson(Map<String, dynamic> json) {
  final DeviceVersionEntity deviceVersionEntity = DeviceVersionEntity();
  final String? code = jsonConvert.convert<String>(json['code']);
  if (code != null) {
    deviceVersionEntity.code = code;
  }
  final String? msg = jsonConvert.convert<String>(json['msg']);
  if (msg != null) {
    deviceVersionEntity.msg = msg;
  }
  final DeviceVersionData? data = jsonConvert.convert<DeviceVersionData>(
      json['data']);
  if (data != null) {
    deviceVersionEntity.data = data;
  }
  return deviceVersionEntity;
}

Map<String, dynamic> $DeviceVersionEntityToJson(DeviceVersionEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['code'] = entity.code;
  data['msg'] = entity.msg;
  data['data'] = entity.data?.toJson();
  return data;
}

extension DeviceVersionEntityExtension on DeviceVersionEntity {
  DeviceVersionEntity copyWith({
    String? code,
    String? msg,
    DeviceVersionData? data,
  }) {
    return DeviceVersionEntity()
      ..code = code ?? this.code
      ..msg = msg ?? this.msg
      ..data = data ?? this.data;
  }
}

DeviceVersionData $DeviceVersionDataFromJson(Map<String, dynamic> json) {
  final DeviceVersionData deviceVersionData = DeviceVersionData();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    deviceVersionData.id = id;
  }
  final String? versionName = jsonConvert.convert<String>(json['versionName']);
  if (versionName != null) {
    deviceVersionData.versionName = versionName;
  }
  final String? versionNum = jsonConvert.convert<String>(json['versionNum']);
  if (versionNum != null) {
    deviceVersionData.versionNum = versionNum;
  }
  final String? minimumVersionNum = jsonConvert.convert<String>(
      json['minimumVersionNum']);
  if (minimumVersionNum != null) {
    deviceVersionData.minimumVersionNum = minimumVersionNum;
  }
  final String? versionText = jsonConvert.convert<String>(json['versionText']);
  if (versionText != null) {
    deviceVersionData.versionText = versionText;
  }
  final String? versionUrl = jsonConvert.convert<String>(json['versionUrl']);
  if (versionUrl != null) {
    deviceVersionData.versionUrl = versionUrl;
  }
  final String? checkText = jsonConvert.convert<String>(json['checkText']);
  if (checkText != null) {
    deviceVersionData.checkText = checkText;
  }
  final String? versionStatus = jsonConvert.convert<String>(
      json['versionStatus']);
  if (versionStatus != null) {
    deviceVersionData.versionStatus = versionStatus;
  }
  final String? versionType = jsonConvert.convert<String>(json['versionType']);
  if (versionType != null) {
    deviceVersionData.versionType = versionType;
  }
  final String? createTime = jsonConvert.convert<String>(json['createTime']);
  if (createTime != null) {
    deviceVersionData.createTime = createTime;
  }
  final String? updateTime = jsonConvert.convert<String>(json['updateTime']);
  if (updateTime != null) {
    deviceVersionData.updateTime = updateTime;
  }
  return deviceVersionData;
}

Map<String, dynamic> $DeviceVersionDataToJson(DeviceVersionData entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['versionName'] = entity.versionName;
  data['versionNum'] = entity.versionNum;
  data['minimumVersionNum'] = entity.minimumVersionNum;
  data['versionText'] = entity.versionText;
  data['versionUrl'] = entity.versionUrl;
  data['checkText'] = entity.checkText;
  data['versionStatus'] = entity.versionStatus;
  data['versionType'] = entity.versionType;
  data['createTime'] = entity.createTime;
  data['updateTime'] = entity.updateTime;
  return data;
}

extension DeviceVersionDataExtension on DeviceVersionData {
  DeviceVersionData copyWith({
    int? id,
    String? versionName,
    String? versionNum,
    String? minimumVersionNum,
    String? versionText,
    String? versionUrl,
    String? checkText,
    String? versionStatus,
    String? versionType,
    String? createTime,
    String? updateTime,
  }) {
    return DeviceVersionData()
      ..id = id ?? this.id
      ..versionName = versionName ?? this.versionName
      ..versionNum = versionNum ?? this.versionNum
      ..minimumVersionNum = minimumVersionNum ?? this.minimumVersionNum
      ..versionText = versionText ?? this.versionText
      ..versionUrl = versionUrl ?? this.versionUrl
      ..checkText = checkText ?? this.checkText
      ..versionStatus = versionStatus ?? this.versionStatus
      ..versionType = versionType ?? this.versionType
      ..createTime = createTime ?? this.createTime
      ..updateTime = updateTime ?? this.updateTime;
  }
}